package bbs.service;

import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.multimodalconversation.MultiModalConversationResult;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.exception.UploadFileException;
import org.springframework.http.codec.ServerSentEvent;
import reactor.core.publisher.Flux;

public interface TongYiService {
    /**
     * 流式输出
     * @param gen
     * @param userMsg
     * @return
     */
    Flux<ServerSentEvent<String>> streamCallWithMessage(Generation gen, Message userMsg) throws NoApiKeyException, InputRequiredException;

    /**
     * 读取图片信息
     * @param message
     * @param imageUrl
     * @return
     * @throws NoApiKeyException
     * @throws UploadFileException
     */
    MultiModalConversationResult readImage(String message, String imageUrl) throws NoApiKeyException, UploadFileException;

    /**
     * 非流式输出
     * @param message
     * @return
     * @throws NoApiKeyException
     * @throws UploadFileException
     */
    MultiModalConversationResult notStream(String message) throws NoApiKeyException, UploadFileException;

}
